<!DOCTYPE html>
<html lang="en-US">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>项目部署运行篇 | 选课系统项目文档</title>
    <meta name="generator" content="VuePress 1.8.2">
    <link rel="icon" href="https://q4.qlogo.cn/g?b=qq&amp;nk=1906249647&amp;s=640">
    <meta name="description" content="风离 & 苏才华">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no">
    
    <link rel="preload" href="/assets/css/0.styles.cdd75a34.css" as="style"><link rel="preload" href="/assets/js/app.1463cf64.js" as="script"><link rel="preload" href="/assets/js/3.027404ff.js" as="script"><link rel="preload" href="/assets/js/1.01246aca.js" as="script"><link rel="preload" href="/assets/js/12.278d760d.js" as="script"><link rel="prefetch" href="/assets/js/10.f00be53f.js"><link rel="prefetch" href="/assets/js/11.5aad7048.js"><link rel="prefetch" href="/assets/js/13.3ec88902.js"><link rel="prefetch" href="/assets/js/14.c212e7b5.js"><link rel="prefetch" href="/assets/js/15.16a5da8c.js"><link rel="prefetch" href="/assets/js/4.330d092c.js"><link rel="prefetch" href="/assets/js/5.68480449.js"><link rel="prefetch" href="/assets/js/6.412d3c2f.js"><link rel="prefetch" href="/assets/js/7.cacb4248.js"><link rel="prefetch" href="/assets/js/8.73d07ada.js"><link rel="prefetch" href="/assets/js/9.3cbabfc0.js">
    <link rel="stylesheet" href="/assets/css/0.styles.cdd75a34.css">
  </head>
  <body>
    <div id="app" data-server-rendered="true"><div class="theme-container no-sidebar" data-v-1aefc0b4><div data-v-1aefc0b4><div id="loader-wrapper" class="loading-wrapper" data-v-d48f4d20 data-v-1aefc0b4 data-v-1aefc0b4><div class="loader-main" data-v-d48f4d20><div data-v-d48f4d20></div><div data-v-d48f4d20></div><div data-v-d48f4d20></div><div data-v-d48f4d20></div></div> <!----> <!----></div> <div class="password-shadow password-wrapper-out" style="display:none;" data-v-25ba6db2 data-v-1aefc0b4 data-v-1aefc0b4><h3 class="title" data-v-25ba6db2 data-v-25ba6db2>选课系统项目文档</h3> <p class="description" data-v-25ba6db2 data-v-25ba6db2>风离 &amp; 苏才华</p> <label id="box" class="inputBox" data-v-25ba6db2 data-v-25ba6db2><input type="password" value="" data-v-25ba6db2> <span data-v-25ba6db2>Konck! Knock!</span> <button data-v-25ba6db2>OK</button></label> <div class="footer" data-v-25ba6db2 data-v-25ba6db2><span data-v-25ba6db2><i class="iconfont reco-theme" data-v-25ba6db2></i> <a target="blank" href="https://vuepress-theme-reco.recoluan.com" data-v-25ba6db2>vuePress-theme-reco</a></span> <span data-v-25ba6db2><i class="iconfont reco-copyright" data-v-25ba6db2></i> <a data-v-25ba6db2><span data-v-25ba6db2>风离</span>
            
          <!---->
          2022
        </a></span></div></div> <div class="hide" data-v-1aefc0b4><header class="navbar" data-v-1aefc0b4><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/" class="home-link router-link-active"><img src="https://q4.qlogo.cn/g?b=qq&amp;nk=1906249647&amp;s=640" alt="选课系统项目文档" class="logo"> <span class="site-name">选课系统项目文档</span></a> <div class="links"><div class="color-picker"><a class="color-button"><i class="iconfont reco-color"></i></a> <div class="color-picker-menu" style="display:none;"><div class="mode-options"><h4 class="title">Choose mode</h4> <ul class="color-mode-options"><li class="dark">dark</li><li class="auto active">auto</li><li class="light">light</li></ul></div></div></div> <div class="search-box"><i class="iconfont reco-search"></i> <input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/" class="nav-link"><i class="iconfont reco-home"></i>
  Home
</a></div><div class="nav-item"><div class="dropdown-wrapper"><a class="dropdown-title"><span class="title"><i class="iconfont reco-message"></i>
      项目开源地址及接口文档地址
    </span> <span class="arrow right"></span></a> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="https://gitee.com/fl1906249647/course-selection-system.git" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="iconfont reco-gitee"></i>
  Gitee
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li><li class="dropdown-item"><!----> <a href="https://www.apifox.cn/apidoc/shared-42f65f6e-94ab-4a81-88ba-6c4700c21c8e" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="iconfont reco-github"></i>
  接口文档：密码666666
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li></ul></div></div> <!----></nav></div></header> <div class="sidebar-mask" data-v-1aefc0b4></div> <aside class="sidebar" data-v-1aefc0b4><div class="personal-info-wrapper" data-v-39576ba9 data-v-1aefc0b4><img src="https://q4.qlogo.cn/g?b=qq&amp;nk=1906249647&amp;s=640" alt="author-avatar" class="personal-img" data-v-39576ba9> <h3 class="name" data-v-39576ba9>
    风离
  </h3> <div class="num" data-v-39576ba9><div data-v-39576ba9><h3 data-v-39576ba9>4</h3> <h6 data-v-39576ba9>Articles</h6></div> <div data-v-39576ba9><h3 data-v-39576ba9>26</h3> <h6 data-v-39576ba9>Tags</h6></div></div> <ul class="social-links" data-v-39576ba9></ul> <hr data-v-39576ba9></div> <nav class="nav-links"><div class="nav-item"><a href="/" class="nav-link"><i class="iconfont reco-home"></i>
  Home
</a></div><div class="nav-item"><div class="dropdown-wrapper"><a class="dropdown-title"><span class="title"><i class="iconfont reco-message"></i>
      项目开源地址及接口文档地址
    </span> <span class="arrow right"></span></a> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="https://gitee.com/fl1906249647/course-selection-system.git" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="iconfont reco-gitee"></i>
  Gitee
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li><li class="dropdown-item"><!----> <a href="https://www.apifox.cn/apidoc/shared-42f65f6e-94ab-4a81-88ba-6c4700c21c8e" target="_blank" rel="noopener noreferrer" class="nav-link external"><i class="iconfont reco-github"></i>
  接口文档：密码666666
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li></ul></div></div> <!----></nav> <!----> </aside> <div class="password-shadow password-wrapper-in" style="display:none;" data-v-25ba6db2 data-v-1aefc0b4><h3 class="title" data-v-25ba6db2 data-v-25ba6db2>项目部署运行篇</h3> <!----> <label id="box" class="inputBox" data-v-25ba6db2 data-v-25ba6db2><input type="password" value="" data-v-25ba6db2> <span data-v-25ba6db2>Konck! Knock!</span> <button data-v-25ba6db2>OK</button></label> <div class="footer" data-v-25ba6db2 data-v-25ba6db2><span data-v-25ba6db2><i class="iconfont reco-theme" data-v-25ba6db2></i> <a target="blank" href="https://vuepress-theme-reco.recoluan.com" data-v-25ba6db2>vuePress-theme-reco</a></span> <span data-v-25ba6db2><i class="iconfont reco-copyright" data-v-25ba6db2></i> <a data-v-25ba6db2><span data-v-25ba6db2>风离</span>
            
          <!---->
          2022
        </a></span></div></div> <div data-v-1aefc0b4><main class="page"><section><div class="page-title"><h1 class="title">项目部署运行篇</h1> <div data-v-f875f3fc><i class="iconfont reco-account" data-v-f875f3fc><span data-v-f875f3fc>风离</span></i> <i class="iconfont reco-date" data-v-f875f3fc><span data-v-f875f3fc>3/28/2022</span></i> <!----> <!----></div></div> <div class="theme-reco-content content__default"><h1 id="前端"><a href="#前端" class="header-anchor">#</a> 前端</h1> <hr> <h2 id="web端"><a href="#web端" class="header-anchor">#</a> Web端</h2> <h3 id="本地运行"><a href="#本地运行" class="header-anchor">#</a> 本地运行</h3> <div class="custom-block warning"><p class="title"></p><h4 id="git拉取代码到本地"><a href="#git拉取代码到本地" class="header-anchor">#</a> git拉取代码到本地</h4> <blockquote><div class="language-sh line-numbers-mode"><pre class="language-sh"><code><span class="token function">git</span> clone -b vue_dev https://gitee.com/fl1906249647/course-selection-system.git
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div></blockquote> <h4 id="环境搭建-node-版本-8"><a href="#环境搭建-node-版本-8" class="header-anchor">#</a> 环境搭建(node 版本 &gt; 8)</h4> <div class="language- line-numbers-mode"><pre class="language-text"><code>node 版本：v9.4.0
npm 版本：6.10.2
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><h4 id="依赖下载慢"><a href="#依赖下载慢" class="header-anchor">#</a> 依赖下载慢</h4> <div class="language-aidl line-numbers-mode"><pre class="language-text"><code>~ nrm -V
1.0.2
➜  ~ nrm ls
  npm ---- https://registry.npmjs.org/
  cnpm --- http://r.cnpmjs.org/
* taobao - https://registry.npm.taobao.org/
  nj ----- https://registry.nodejitsu.com/
  rednpm - http://registry.mirror.cqupt.edu.cn/
  npmMirror  https://skimdb.npmjs.com/registry/
  edunpm - http://registry.enpmjs.org/
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br></div></div><h4 id="运行"><a href="#运行" class="header-anchor">#</a> 运行</h4> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code>  
<span class="token comment"># 安装依赖</span>
<span class="token function">npm</span> <span class="token function">install</span>

<span class="token comment"># 本地开发 开启服务</span>
<span class="token function">npm</span> run dev
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br></div></div><p>浏览器访问 http://localhost:8080/</p> <h3 id="发布"><a href="#发布" class="header-anchor">#</a> 发布</h3> <div class="language-bash line-numbers-mode"><pre class="language-bash"><code><span class="token comment"># 构建生成环境</span>
<span class="token function">npm</span> run build:prod
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div></div><h3 id="部署上云"><a href="#部署上云" class="header-anchor">#</a> 部署上云</h3> <ul><li><p>提交代码到你个人仓库 使用腾讯云web应用托管自动实现CI/CD 部署</p></li> <li><p>详细步骤如下</p> <p><img src="https://img.flya.top/img/2022/03/30%E6%97%A514%E6%97%B648%E5%88%8621%E7%A7%92.png" alt="image-20220330144819820"></p></li></ul> <p><img src="https://img.flya.top/img/2022/03/30%E6%97%A514%E6%97%B651%E5%88%8649%E7%A7%92.png" alt="image-20220330144842372"></p> <p>导入 等他构建（<strong>构建命令参见本地运行</strong>）完访问即可</p> <h2 id="小程序端"><a href="#小程序端" class="header-anchor">#</a> 小程序端</h2> <h3 id="本地运行-2"><a href="#本地运行-2" class="header-anchor">#</a> 本地运行</h3> <div class="custom-block tip"><p class="title">微信小程序自带官方开发者工具</p><ul><li><p><img src="https://s2.loli.net/2022/03/30/8XmqWBY1Rl3U4yA.png" alt="image.png">微信开发者工具</p></li> <li><p>打开选择项目<img src="https://s2.loli.net/2022/03/30/CS25hFMZwjvOT1G.png" alt="image.png"></p></li> <li><p>进入开发者工具后工具栏有一下功能
<img src="https://s2.loli.net/2022/03/30/UZBcw2j6deTGzIF.png" alt="image.png"></p> <ul><li>真机调试 待开发工具编译完成就可以用微信扫描二维码进行真机调试</li> <li>模拟器可以在电脑调试</li> <li><img src="https://s2.loli.net/2022/03/30/tFew6xZ9cCfp4Yn.png" alt="image.png"></li></ul></li></ul></div><h3 id="部署上云-2"><a href="#部署上云-2" class="header-anchor">#</a> 部署上云</h3> <div class="custom-block tip"><p class="title">微信小程序代码程序直接可上传到微信官方服务器</p><ul><li>点击上传</li></ul> <p><img src="https://s2.loli.net/2022/03/30/PaeSqWKF25LbdkY.png" alt="image.png"></p> <ul><li>就可以在微信公众平台的版本管理中看到小程序处于体验版</li></ul> <p><img src="https://s2.loli.net/2022/03/30/Q5EnierYWTwJObf.png" alt="image.png"></p> <ul><li>然后分享二维码,并且添加体验人员，体验人员就可以体验</li></ul> <p><img src="https://s2.loli.net/2022/03/30/srSPtCRAaMiBjTo.png" alt="image.png"></p> <ul><li>如果体验中没有bug,我们就可以提交体验版给微信官方审核，审核通过后用户就可以直接正常使用</li></ul> <p><img src="https://s2.loli.net/2022/03/30/b8FSVgqoMY9fwyK.png" alt="image.png"></p></div><h1 id="后端"><a href="#后端" class="header-anchor">#</a> 后端</h1> <hr> <h2 id="后端本地运行"><a href="#后端本地运行" class="header-anchor">#</a> 后端本地运行</h2> <h3 id="前置环境"><a href="#前置环境" class="header-anchor">#</a> 前置环境</h3> <div class="custom-block tip"><p class="title">必须</p><ul><li><code>Java：jdk1.8</code></li> <li><code>Mysql: 5.7</code>(数据库)</li> <li><code>Redis</code>(缓存数据库)</li> <li><code>MongoDB</code>（文档数据库）</li> <li><code>Nacos: 2.0.4</code> （服务注册配置中心）</li> <li><code>Sentinel</code>（服务降级熔断）</li> <li><code>RabbitMq</code>（消息队列）</li> <li><code>Maven</code>(配置阿里镜像源 不然更新依赖很慢)</li> <li><code>Zipkin</code>(链路追踪)</li></ul></div><p><code>开启上述所有服务 以备下述所用</code></p> <p><strong>假定本地已有上述环境</strong></p> <ul><li><p>从代码仓库拉取代码</p> <blockquote><div class="language-sh line-numbers-mode"><pre class="language-sh"><code><span class="token comment">## 本地新建文件夹 在此文件夹下</span>
<span class="token function">git</span> init
<span class="token comment">## 拉取代码 选择test分支</span>
<span class="token function">git</span> clone -b <span class="token builtin class-name">test</span> https://gitee.com/fl1906249647/course-selection-system.git

</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br></div></div></blockquote></li></ul> <blockquote></blockquote> <ul><li><p>使用IDEA 打开稍等片刻 等maven依赖下载完毕</p></li> <li><p>导入sql文件到数据库</p></li> <li><p>如果只想使用本地配置 不使用配置中心 则</p></li></ul> <p><img src="https://img.flya.top/img/2022/03/29%E6%97%A516%E6%97%B626%E5%88%8649%E7%A7%92.png" alt="image-20220329162649714"></p> <p>修改application-dev.yml中内容（主要有以下几点）：</p> <ul><li>Mysql的连接信息  端口账号密码</li> <li>Redis的连接信息 端口账号密码</li> <li>RabbitMQ的连接信息 端口账号密码</li> <li>Nacos的连接信息 端口账号密码 （默认 账密都为 nacos）</li> <li>MongoDB的连接信息 端口账号密码和所用的数据库名</li> <li>Sentinel 的连接信息 端口账号密码（默认 账密都为 sentinel）</li></ul> <p>如果想使用Nacos配置中心 则 修改resource中bootstrap.yml中配置中心 如图所示</p> <p><img src="https://img.flya.top/img/2022/03/29%E6%97%A516%E6%97%B630%E5%88%8623%E7%A7%92.png" alt="image-20220329163023768"></p> <p><img src="https://img.flya.top/img/2022/03/29%E6%97%A516%E6%97%B632%E5%88%8605%E7%A7%92.png" alt="image-20220329163205528"></p> <p><img src="https://img.flya.top/img/2022/03/29%E6%97%A516%E6%97%B632%E5%88%8651%E7%A7%92.png" alt="image-20220329163251341"></p> <p><code>将本地的application-dev.yml文件内容写入 对应的 xxx-dev.yaml 修改bootstrap.yaml中profile.active: dev</code></p> <p>四个微服务重复上述过程</p> <h3 id="启动四个微服务"><a href="#启动四个微服务" class="header-anchor">#</a> 启动四个微服务</h3> <p>如果无报错信息 则证明项目成功运行</p> <h2 id="后端部署上云"><a href="#后端部署上云" class="header-anchor">#</a> 后端部署上云</h2> <h3 id="前置环境-2"><a href="#前置环境-2" class="header-anchor">#</a> 前置环境</h3> <p><code>服务器配置： 建议4核8G起步 不然可能不够用</code></p> <ul><li><p>准备一台纯净的Linux系统的服务器 按照<code>Kubesphere</code>官方文档去安装Kubesphere平台</p> <blockquote><p><a href="https://kubesphere.com.cn/" target="_blank" rel="noopener noreferrer">文档地址<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></p></blockquote></li> <li><p>安装 <code>KubeSphere DevOps 系统</code></p> <blockquote><p><a href="https://kubesphere.com.cn/docs/pluggable-components/devops/" target="_blank" rel="noopener noreferrer">文档地址<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></p></blockquote></li> <li><p>创建企业空间 项目 和 流水线 （读者可根据官方文档 自行创建）</p></li> <li><p>将本地代码提交至Git仓库  （下面这个文件为Jenkinsfile）</p> <p><img src="https://img.flya.top/img/2022/03/29%E6%97%A516%E6%97%B649%E5%88%8648%E7%A7%92.png" alt="image-20220329164948148"></p></li> <li><p>创建凭证</p> <p><img src="https://img.flya.top/img/2022/03/29%E6%97%A516%E6%97%B652%E5%88%8603%E7%A7%92.png" alt="image-20220329165203063"></p></li></ul> <p><img src="https://img.flya.top/img/2022/03/29%E6%97%A516%E6%97%B659%E5%88%8649%E7%A7%92.png" alt="image-20220329165949455"></p> <h3 id="在云上搭建各种服务集群"><a href="#在云上搭建各种服务集群" class="header-anchor">#</a> 在云上搭建各种服务集群</h3> <blockquote><p><a href="/blogs/readme-3.html">详见这篇文档</a></p></blockquote> <h3 id="修改bootstrap-yaml"><a href="#修改bootstrap-yaml" class="header-anchor">#</a> 修改bootstrap.yaml</h3> <ul><li><p>修改bootstrap.yaml中配置 参见上述 <code>bootstrap.yaml截图</code></p></li> <li><p>配置各个微服务的application.yaml 修改 各个服务中 mysql nacos … 等等服务的云上服务集群地址 并在bootstrap.yaml中启用配置</p></li></ul> <h3 id="构建jenkins流水线"><a href="#构建jenkins流水线" class="header-anchor">#</a> 构建Jenkins流水线</h3> <p><img src="https://img.flya.top/img/2022/03/29%E6%97%A517%E6%97%B607%E5%88%8607%E7%A7%92.png" alt="image-20220329170707673"></p> <p>然后 他会自动扫描你仓库下的Jenkinsfile 等待项目构建完毕即可</p> <div class="custom-block tip"><p class="title"></p><p>修改每个项目下的 <code>项目名/delopy/*</code> 配置好副本数量和内存 CPU限制 举个栗子</p> <blockquote><div class="language-yaml line-numbers-mode"><pre class="language-yaml"><code><span class="token key atrule">apiVersion</span><span class="token punctuation">:</span> apps/v1
<span class="token key atrule">kind</span><span class="token punctuation">:</span> Deployment
<span class="token key atrule">metadata</span><span class="token punctuation">:</span>
  <span class="token key atrule">labels</span><span class="token punctuation">:</span>
    <span class="token key atrule">app</span><span class="token punctuation">:</span> ace<span class="token punctuation">-</span>gate
  <span class="token key atrule">name</span><span class="token punctuation">:</span> ace<span class="token punctuation">-</span>gate
  <span class="token key atrule">namespace</span><span class="token punctuation">:</span> choose<span class="token punctuation">-</span>course<span class="token punctuation">-</span>system   <span class="token comment">#一定要写名称空间</span>
<span class="token key atrule">spec</span><span class="token punctuation">:</span>
  <span class="token key atrule">progressDeadlineSeconds</span><span class="token punctuation">:</span> <span class="token number">600</span>
  <span class="token key atrule">replicas</span><span class="token punctuation">:</span> <span class="token number">1</span> <span class="token comment"># 副本分片数 即你这个微服务的数量</span>
  <span class="token key atrule">selector</span><span class="token punctuation">:</span>
    <span class="token key atrule">matchLabels</span><span class="token punctuation">:</span>
      <span class="token key atrule">app</span><span class="token punctuation">:</span> ace<span class="token punctuation">-</span>gate
  <span class="token key atrule">strategy</span><span class="token punctuation">:</span>
    <span class="token key atrule">rollingUpdate</span><span class="token punctuation">:</span>
      <span class="token key atrule">maxSurge</span><span class="token punctuation">:</span> 50%
      <span class="token key atrule">maxUnavailable</span><span class="token punctuation">:</span> 50%
    <span class="token key atrule">type</span><span class="token punctuation">:</span> RollingUpdate
  <span class="token key atrule">template</span><span class="token punctuation">:</span>
    <span class="token key atrule">metadata</span><span class="token punctuation">:</span>
      <span class="token key atrule">labels</span><span class="token punctuation">:</span>
        <span class="token key atrule">app</span><span class="token punctuation">:</span> ace<span class="token punctuation">-</span>gate
    <span class="token key atrule">spec</span><span class="token punctuation">:</span>
      <span class="token key atrule">imagePullSecrets</span><span class="token punctuation">:</span>
        <span class="token punctuation">-</span> <span class="token key atrule">name</span><span class="token punctuation">:</span> tx<span class="token punctuation">-</span>docker<span class="token punctuation">-</span>hub  <span class="token comment">#提前在项目下配置访问阿里云的账号密码</span>
      <span class="token key atrule">containers</span><span class="token punctuation">:</span>
        <span class="token punctuation">-</span> <span class="token key atrule">image</span><span class="token punctuation">:</span> $REGISTRY/$ALIYUNHUB_NAMESPACE/ace<span class="token punctuation">-</span>gate<span class="token punctuation">:</span>SNAPSHOT<span class="token punctuation">-</span>$BUILD_NUMBER
          <span class="token key atrule">imagePullPolicy</span><span class="token punctuation">:</span> Always
          <span class="token key atrule">name</span><span class="token punctuation">:</span> app
          <span class="token key atrule">ports</span><span class="token punctuation">:</span>
            <span class="token punctuation">-</span> <span class="token key atrule">name</span><span class="token punctuation">:</span> http<span class="token punctuation">-</span>ace<span class="token punctuation">-</span>gate
              <span class="token key atrule">containerPort</span><span class="token punctuation">:</span> <span class="token number">8080</span>
              <span class="token key atrule">protocol</span><span class="token punctuation">:</span> TCP
          <span class="token key atrule">resources</span><span class="token punctuation">:</span>
            <span class="token key atrule">limits</span><span class="token punctuation">:</span>
              <span class="token key atrule">cpu</span><span class="token punctuation">:</span> <span class="token string">'3'</span> <span class="token comment"># 限制CPU核数</span>
              <span class="token key atrule">memory</span><span class="token punctuation">:</span> 3000Mi <span class="token comment"># 限制内存数</span>
            <span class="token key atrule">requests</span><span class="token punctuation">:</span>
              <span class="token key atrule">cpu</span><span class="token punctuation">:</span> 60m <span class="token comment"># 预先分配CPU数</span>
              <span class="token key atrule">memory</span><span class="token punctuation">:</span> 50Mi <span class="token comment"># 预先分配内存数</span>
          <span class="token key atrule">terminationMessagePath</span><span class="token punctuation">:</span> /dev/termination<span class="token punctuation">-</span>log
          <span class="token key atrule">terminationMessagePolicy</span><span class="token punctuation">:</span> File
      <span class="token key atrule">dnsPolicy</span><span class="token punctuation">:</span> ClusterFirst
      <span class="token key atrule">restartPolicy</span><span class="token punctuation">:</span> Always
      <span class="token key atrule">terminationGracePeriodSeconds</span><span class="token punctuation">:</span> <span class="token number">30</span>
<span class="token punctuation">---</span>
<span class="token key atrule">apiVersion</span><span class="token punctuation">:</span> v1
<span class="token key atrule">kind</span><span class="token punctuation">:</span> Service
<span class="token key atrule">metadata</span><span class="token punctuation">:</span>
  <span class="token key atrule">labels</span><span class="token punctuation">:</span>
    <span class="token key atrule">app</span><span class="token punctuation">:</span> ace<span class="token punctuation">-</span>gate
  <span class="token key atrule">name</span><span class="token punctuation">:</span> ace<span class="token punctuation">-</span>gate
  <span class="token key atrule">namespace</span><span class="token punctuation">:</span> choose<span class="token punctuation">-</span>course<span class="token punctuation">-</span>system
<span class="token key atrule">spec</span><span class="token punctuation">:</span>
  <span class="token key atrule">ports</span><span class="token punctuation">:</span>
    <span class="token punctuation">-</span> <span class="token key atrule">name</span><span class="token punctuation">:</span> http
      <span class="token key atrule">port</span><span class="token punctuation">:</span> <span class="token number">8080</span>
      <span class="token key atrule">protocol</span><span class="token punctuation">:</span> TCP
      <span class="token key atrule">targetPort</span><span class="token punctuation">:</span> <span class="token number">8080</span>
  <span class="token key atrule">selector</span><span class="token punctuation">:</span>
    <span class="token key atrule">app</span><span class="token punctuation">:</span> ace<span class="token punctuation">-</span>gate
  <span class="token key atrule">sessionAffinity</span><span class="token punctuation">:</span> None
  <span class="token key atrule">type</span><span class="token punctuation">:</span> ClusterIP
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br><span class="line-number">20</span><br><span class="line-number">21</span><br><span class="line-number">22</span><br><span class="line-number">23</span><br><span class="line-number">24</span><br><span class="line-number">25</span><br><span class="line-number">26</span><br><span class="line-number">27</span><br><span class="line-number">28</span><br><span class="line-number">29</span><br><span class="line-number">30</span><br><span class="line-number">31</span><br><span class="line-number">32</span><br><span class="line-number">33</span><br><span class="line-number">34</span><br><span class="line-number">35</span><br><span class="line-number">36</span><br><span class="line-number">37</span><br><span class="line-number">38</span><br><span class="line-number">39</span><br><span class="line-number">40</span><br><span class="line-number">41</span><br><span class="line-number">42</span><br><span class="line-number">43</span><br><span class="line-number">44</span><br><span class="line-number">45</span><br><span class="line-number">46</span><br><span class="line-number">47</span><br><span class="line-number">48</span><br><span class="line-number">49</span><br><span class="line-number">50</span><br><span class="line-number">51</span><br><span class="line-number">52</span><br><span class="line-number">53</span><br><span class="line-number">54</span><br><span class="line-number">55</span><br><span class="line-number">56</span><br><span class="line-number">57</span><br><span class="line-number">58</span><br><span class="line-number">59</span><br><span class="line-number">60</span><br><span class="line-number">61</span><br><span class="line-number">62</span><br><span class="line-number">63</span><br></div></div></blockquote></div><h3 id="配置项目构建成功的邮件通知"><a href="#配置项目构建成功的邮件通知" class="header-anchor">#</a> 配置项目构建成功的邮件通知</h3> <blockquote><p><a href="https://kubesphere.com.cn/docs/devops-user-guide/how-to-use/jenkins-email/" target="_blank" rel="noopener noreferrer">参考文档<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></p></blockquote> <h3 id="等待项目运行成功-的通知邮件-即可"><a href="#等待项目运行成功-的通知邮件-即可" class="header-anchor">#</a> 等待项目运行成功 的通知邮件 即可</h3></div></section> <footer class="page-edit"><!----> <div class="last-updated"><span class="prefix">Last Updated: </span> <span class="time">3/30/2022, 9:15:30 PM</span></div></footer> <!----> <div class="comments-wrapper"><!----></div> <ul class="side-bar sub-sidebar-wrapper" style="width:12rem;" data-v-cb1513f6><li class="level-2" data-v-cb1513f6><a href="/blogs/readme-1.html#web端" class="sidebar-link reco-side-web端" data-v-cb1513f6>Web端</a></li><li class="level-3" data-v-cb1513f6><a href="/blogs/readme-1.html#本地运行" class="sidebar-link reco-side-本地运行" data-v-cb1513f6>本地运行</a></li><li class="level-3" data-v-cb1513f6><a href="/blogs/readme-1.html#发布" class="sidebar-link reco-side-发布" data-v-cb1513f6>发布</a></li><li class="level-3" data-v-cb1513f6><a href="/blogs/readme-1.html#部署上云" class="sidebar-link reco-side-部署上云" data-v-cb1513f6>部署上云</a></li><li class="level-2" data-v-cb1513f6><a href="/blogs/readme-1.html#小程序端" class="sidebar-link reco-side-小程序端" data-v-cb1513f6>小程序端</a></li><li class="level-3" data-v-cb1513f6><a href="/blogs/readme-1.html#本地运行-2" class="sidebar-link reco-side-本地运行-2" data-v-cb1513f6>本地运行</a></li><li class="level-3" data-v-cb1513f6><a href="/blogs/readme-1.html#部署上云-2" class="sidebar-link reco-side-部署上云-2" data-v-cb1513f6>部署上云</a></li><li class="level-2" data-v-cb1513f6><a href="/blogs/readme-1.html#后端本地运行" class="sidebar-link reco-side-后端本地运行" data-v-cb1513f6>后端本地运行</a></li><li class="level-3" data-v-cb1513f6><a href="/blogs/readme-1.html#前置环境" class="sidebar-link reco-side-前置环境" data-v-cb1513f6>前置环境</a></li><li class="level-3" data-v-cb1513f6><a href="/blogs/readme-1.html#启动四个微服务" class="sidebar-link reco-side-启动四个微服务" data-v-cb1513f6>启动四个微服务</a></li><li class="level-2" data-v-cb1513f6><a href="/blogs/readme-1.html#后端部署上云" class="sidebar-link reco-side-后端部署上云" data-v-cb1513f6>后端部署上云</a></li><li class="level-3" data-v-cb1513f6><a href="/blogs/readme-1.html#前置环境-2" class="sidebar-link reco-side-前置环境-2" data-v-cb1513f6>前置环境</a></li><li class="level-3" data-v-cb1513f6><a href="/blogs/readme-1.html#在云上搭建各种服务集群" class="sidebar-link reco-side-在云上搭建各种服务集群" data-v-cb1513f6>在云上搭建各种服务集群</a></li><li class="level-3" data-v-cb1513f6><a href="/blogs/readme-1.html#修改bootstrap-yaml" class="sidebar-link reco-side-修改bootstrap-yaml" data-v-cb1513f6>修改bootstrap.yaml</a></li><li class="level-3" data-v-cb1513f6><a href="/blogs/readme-1.html#构建jenkins流水线" class="sidebar-link reco-side-构建jenkins流水线" data-v-cb1513f6>构建Jenkins流水线</a></li><li class="level-3" data-v-cb1513f6><a href="/blogs/readme-1.html#配置项目构建成功的邮件通知" class="sidebar-link reco-side-配置项目构建成功的邮件通知" data-v-cb1513f6>配置项目构建成功的邮件通知</a></li><li class="level-3" data-v-cb1513f6><a href="/blogs/readme-1.html#等待项目运行成功-的通知邮件-即可" class="sidebar-link reco-side-等待项目运行成功-的通知邮件-即可" data-v-cb1513f6>等待项目运行成功 的通知邮件 即可</a></li></ul></main> <!----></div></div></div></div><div class="global-ui"><div class="back-to-ceiling" style="right:1rem;bottom:6rem;width:2.5rem;height:2.5rem;border-radius:.25rem;line-height:2.5rem;display:none;" data-v-c6073ba8 data-v-c6073ba8><svg t="1574745035067" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5404" class="icon" data-v-c6073ba8><path d="M526.60727968 10.90185116a27.675 27.675 0 0 0-29.21455937 0c-131.36607665 82.28402758-218.69155461 228.01873535-218.69155402 394.07834331a462.20625001 462.20625001 0 0 0 5.36959153 69.94390903c1.00431239 6.55289093-0.34802892 13.13561351-3.76865779 18.80351572-32.63518765 54.11355614-51.75690182 118.55860487-51.7569018 187.94566865a371.06718723 371.06718723 0 0 0 11.50484808 91.98906777c6.53300375 25.50556257 41.68394495 28.14064038 52.69160883 4.22606766 17.37162448-37.73630017 42.14135425-72.50938081 72.80769204-103.21549295 2.18761121 3.04276886 4.15646224 6.24463696 6.40373557 9.22774369a1871.4375 1871.4375 0 0 0 140.04691725 5.34970492 1866.36093723 1866.36093723 0 0 0 140.04691723-5.34970492c2.24727335-2.98310674 4.21612437-6.18497483 6.3937923-9.2178004 30.66633723 30.70611158 55.4360664 65.4791928 72.80769147 103.21549355 11.00766384 23.91457269 46.15860503 21.27949489 52.69160879-4.22606768a371.15156223 371.15156223 0 0 0 11.514792-91.99901164c0-69.36717486-19.13165746-133.82216804-51.75690182-187.92578088-3.42062944-5.66790279-4.76302748-12.26056868-3.76865837-18.80351632a462.20625001 462.20625001 0 0 0 5.36959269-69.943909c-0.00994388-166.08943902-87.32547796-311.81420293-218.6915546-394.09823051zM605.93803103 357.87693858a93.93749974 93.93749974 0 1 1-187.89594924 6.1e-7 93.93749974 93.93749974 0 0 1 187.89594924-6.1e-7z" p-id="5405" data-v-c6073ba8></path><path d="M429.50777625 765.63860547C429.50777625 803.39355007 466.44236686 1000.39046097 512.00932183 1000.39046097c45.56695499 0 82.4922232-197.00623328 82.5015456-234.7518555 0-37.75494459-36.9345906-68.35043303-82.4922232-68.34111062-45.57627738-0.00932239-82.52019037 30.59548842-82.51086798 68.34111062z" p-id="5406" data-v-c6073ba8></path></svg></div></div></div>
    <script src="/assets/js/app.1463cf64.js" defer></script><script src="/assets/js/3.027404ff.js" defer></script><script src="/assets/js/1.01246aca.js" defer></script><script src="/assets/js/12.278d760d.js" defer></script>
  </body>
</html>
